package com.kun.portal.webframe.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by Administrator on 2018/7/5.
 */
@Entity
@Table(
        name = "fbo_repair_record"
)
@DynamicUpdate
public class RepairRecordPo {
    @Id
    @GeneratedValue(
            generator = "id"
    )
    @GenericGenerator(
            name = "id",
            strategy = "uuid"
    )
    @Column(
            name = "id",
            length = 32,
            nullable = false
    )
    private String id ;


    @Column(
            name = "repair_type",
            length = 32
    )
    private String repairType;

    @Column(
            name = "repair_plane_date"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date repairPlaneDate;
    @Column(
            name = "repair_date"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date repairDate;

    @Column(
            name = "repair_content",
            length = 500

    )
    private String repairContent;
    @Column(
            name = "repair_model",
            length = 50
    )
    private String repairModel;

    @Column(
            name = "repair_status",
            length = 50
    )
    private String repairStatus;
    @Column(
            name = "re_mark",
            length = 50
    )
    private String reMark;

    @Column(
            name = "cause_of_failure",
            length = 50
    )
    private String causeOfFailure;
    @Column(
            name = "result",
            length = 50
    )
    private String result;
    @Column(
            name = "date_of_failure",
            length = 50
    )
    private Date dateOfFailure;
    @Column(
            name = "money",
            length = 50
    )
    private String money;
    @Column(
            name = "has_implement",
            length = 50
    )
    private boolean hasImplement;
    @Column(
            name = "is_plane_repair",
            length = 50
    )
    private boolean isPlaneRepair;

    @OneToOne(targetEntity = FwUserPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "repair_person_id",referencedColumnName ="user_ID" )
    @JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class,property="@id")
    private FwUserPo repairPerson;
    @OneToOne(targetEntity = FwUserPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "duty_person_id",referencedColumnName ="user_ID" )
    @JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class,property="@id")
    private FwUserPo dutyPerson;

    @OneToOne(targetEntity = EquipmentPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "equipment_id",referencedColumnName ="id" )
    @JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class,property="@id")
    private EquipmentPo equipmentPo;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRepairType() {
        return repairType;
    }

    public void setRepairType(String repairType) {
        this.repairType = repairType;
    }

    public Date getRepairPlaneDate() {
        return repairPlaneDate;
    }

    public void setRepairPlaneDate(Date repairPlaneDate) {
        this.repairPlaneDate = repairPlaneDate;
    }




    public String getRepairContent() {
        return repairContent;
    }

    public void setRepairContent(String repairContent) {
        this.repairContent = repairContent;
    }

    public String getRepairModel() {
        return repairModel;
    }

    public void setRepairModel(String repairModel) {
        this.repairModel = repairModel;
    }

    public String getRepairStatus() {
        return repairStatus;
    }

    public void setRepairStatus(String repairStatus) {
        this.repairStatus = repairStatus;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
    }

    public String getCauseOfFailure() {
        return causeOfFailure;
    }

    public void setCauseOfFailure(String causeOfFailure) {
        this.causeOfFailure = causeOfFailure;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public Date getDateOfFailure() {
        return dateOfFailure;
    }

    public void setDateOfFailure(Date dateOfFailure) {
        this.dateOfFailure = dateOfFailure;
    }

    public String getMoney() {
        return money;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    public boolean isHasImplement() {
        return hasImplement;
    }

    public void setHasImplement(boolean hasImplement) {
        this.hasImplement = hasImplement;
    }

    public boolean isPlaneRepair() {
        return isPlaneRepair;
    }

    public void setPlaneRepair(boolean planeRepair) {
        isPlaneRepair = planeRepair;
    }

    public FwUserPo getRepairPerson() {
        return repairPerson;
    }

    public void setRepairPerson(FwUserPo repairPerson) {
        this.repairPerson = repairPerson;
    }

    public FwUserPo getDutyPerson() {
        return dutyPerson;
    }

    public void setDutyPerson(FwUserPo dutyPerson) {
        this.dutyPerson = dutyPerson;
    }

    public EquipmentPo getEquipmentPo() {
        return equipmentPo;
    }

    public void setEquipmentPo(EquipmentPo equipmentPo) {
        this.equipmentPo = equipmentPo;
    }
}
